<?php
###############   COPYLEFT GPLv3 LICENSE   ###############
##
## JFX Version 0.2.9
## Website Management Software
## www.jfxcms.com
##
## Copyright 2009 GPLv3 - http://www.opensource.org/licenses/gpl-3.0.html
##
## Anthony Gallon
## oi_antz@hotmail.com
##
## Permission is hereby granted to any person having a copy of this software
## to freely use and modify as required so long as the copyright notices
## and branding remain intact.
##
## Full license details available at http://www.jfxcms.com/license
##
###############   COPYLEFT GPLv3 LICENSE   ###############


//$THEME->addBreadcrumb($this->adminUrl.'/modules/admin/', $this->lang('ap_title_modules_admin'));


// find out which module is selected
$urlParts = explode('?', THIS_PAGE_URL);
$urlParts = explode('/', $urlParts[0]);
$moduleKey = '';
foreach($urlParts as $k=>$v){
    if($v == 'modules') break;
}

if(isset($urlParts[$k+2])){
    $moduleKey = $urlParts[$k+2];
}


// output the module admin content
if(JFX_Module::isValidModule($moduleKey)){

    $url = $CONFIG->adminUrl.'/modules/admin/'.$moduleKey;
	$url = THIS_PAGE_URL;
    $dirname = $CONFIG->modulesDir.'/'.$moduleKey;
    $module = JFX::registry('JFX_Module_'.$moduleKey);
    $eParams = array(
        'module'=>$moduleKey,
        'moduleObject' => $module,
        'url' => $url,
        'dirname' => $dirname
    );

    JFX::hook('JFX_Core.modulesAdminPreRender', $eParams);

    if(method_exists($module, 'admin')) $module->admin($url, $dirname);
    else echo $this->lang('module_has_no_admin');

    JFX::hook('JFX_Core.modulesAdminPostRender', $eParams);

}





